NetPortGradient
NetPortGradient["port"] represents the gradient of the output of a net with respect to the value of the specified input port.
NetPortGradient["param"] represents the gradient of the output with respect to a learned parameter named param.
NetPortGradient[{layer1,layer2,…,"param"}] represents the gradient with respect to a parameter at a specific position in a net.
NetPortGradient[All] represents the gradients with respect to all inputs and parameters.
Please visit the official Wolfram Language Reference for more details and examples on core symbols.